/* 清除默认样式 */
* {
  margin: 0;
  padding: 0;
}

/* 白昼模式下 CSS 变量 */
:root {
  --bg-color: #fff;
  --bg-button-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

/* 夜间模式下 CSS 变量 */
html.dark {
  --bg-color: #222831;
  --bg-button-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

html,
body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
  transition: background-color 0.5s;
}

/* container */
.container {
  height: 100%;
  display: flex;
  margin: 0 auto;
  overflow: hidden;
  max-width: 1200px;
  align-items: center;
  flex-direction: column;
  justify-content: center;

  .box {
    width: 100%;
    height: 500px;
    padding: 50px;
    overflow: hidden;
    position: relative;
  }
}

/* 图标容器 */
.icon-container {
  margin: 0 auto;
  width: fit-content;
  transform: rotate(0);
  transition: transform 0.5s;

  .moon {
    transform: rotateZ(180deg);
    animation: moonRun 2s linear infinite;
  }

  .sun {
    margin-bottom: 100px;
    animation: sunRun 10s linear infinite;
    filter: drop-shadow(0 0 10px rgba(255, 0, 0, 0.5));
  }
}

/* 昼夜切换按钮 */
button.toggle {
  top: 5px;
  right: 5px;
  width: 90px;
  color: #fff;
  height: 30px;
  border: none;
  outline: none;
  font-size: 12px;
  position: fixed;
  cursor: pointer;
  font-weight: bold;
  border-radius: 50px;
  letter-spacing: 3px;
  background-color: skyblue;
  transition: box-shadow 0.5s;
  box-shadow: var(--bg-button-shadow);
}

/* 太阳图标旋转动画 */
@keyframes sunRun {
  from {
    transform: rotate(0);
  }
  to {
    transform: rotate(360deg);
  }
}

/* 月亮图标闪烁动画 */
@keyframes moonRun {
  0% {
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
  }
  50% {
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.8));
  }
  100% {
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
  }
}
